package com.bite.MoveZero;

public class Demo {
    public static void main(String[] args) {

    }
    public void moveZeroes(int[] nums) {
        for (int cur = 0 , dest = -1; cur < nums.length; cur++) {
            //等于 0 不用管，for 循环自动++
            if (nums[cur] != 0) {
                dest++;
                int ret = nums[cur];
                nums[cur] = nums[dest];
                nums[dest] = ret;
            }
        }
    }
}
